package com.szbber.medical.bed.viewmodel.fragment

import android.content.Context
import androidx.lifecycle.MutableLiveData
import com.orhanobut.logger.Logger
import com.szbber.commen.api.Repository
import com.szbber.commen.api.launch
import com.szbber.commen.base.BaseViewModel
import com.szbber.commen.bean.BedCardInfoBean
import com.szbber.commen.bean.MessageListBean
import com.szbber.commen.bean.NurseLevelListBean
import com.szbber.commen.utils.dataStoreRead

class PatientInfoViewModel : BaseViewModel() {

    var bedCardInfoBean = MutableLiveData<BedCardInfoBean>()
    fun getBedCardInfo(context: Context?) = launch(context, {
        val deptCode = dataStoreRead<String>("deptCode")
        val bedCode = dataStoreRead<String>("bedCode")
        val queue = arrayOf("deptCode", deptCode, "bedCode", bedCode)
        val data = Repository.getBedCardInfo(context, *queue)
        bedCardInfoBean.value = data
        getMessageListBean(context, data.data.patientVo.cure_no)
    })

    var messageListBean = MutableLiveData<MessageListBean>()
    fun getMessageListBean(context: Context?, patientId: String?) = launch(context, {
        val queue = arrayOf("patientId", patientId)
        messageListBean.value = Repository.getMessageList(context, *queue)

    })

}